/**
 * outsider.com.cn Inc.
 * Copyright (c) 2011-2022 All Rights Reserved.
 */
package com.yuanmeng.common.core.enums;

import com.yuanmeng.common.core.exception.ServiceException;

import lombok.Getter;

/**
 * @author outsider
 * @version Id: StatusEnum.java, v 0.1 2022/6/1 17:16 outsider Exp $$
 */
@Getter
public enum AfterSaleMethodEnum {
    ALL_PRODUCT("ALL_PRODUCT", "所有商品"),

    SOME_PRODUCT("SOME_PRODUCT", "部分商品");

    private String code;

    private String message;

    AfterSaleMethodEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static void validateAfterSaleMethod(String afterSaleMethod) {
        int num = 0;
        for(AfterSaleMethodEnum ENUM : AfterSaleMethodEnum.values()) {
            if(ENUM.code.equals(afterSaleMethod)) {
                num ++;
            }
        }
        if(num == 0) {
            throw new ServiceException("请求参数非法：afterSaleMethod");
        }
    }
}